import 'package:base_flutter/base_flutter.dart';
import 'package:ls_work/self_medicine/response/self_medicine_library_data.dart';
import 'package:ls_work/self_medicine/self_medicine_api.dart';
class SelfMedicineModel extends BaseMvvmModel{
  @override
  void onCleared() {
  }

  Future<List<SelfMedicineLibraryData>> medicineLibrary({dynamic customerElderId,int page = 1,int rows=20}) async {
    var map = {
      "customerElderId":customerElderId,
      "page":page,
      "rows":rows,
    };
    var data = await HttpGo.instance.postData(SelfMedicineApi.medicineLibrary,data: map,options: Options(contentType: Headers.formUrlEncodedContentType));
    if("0"==data['code']){
      return ((data['data']['rows']as List?)??[]).map((e)=>SelfMedicineLibraryData.fromJson(e)).toList();
    }else{
      throw data['msg'];
    }
  }
}